// 给axios封装get方法和post方法
import axios from "./axios";

// 定义接口
interface typeObj {
    [key: string]: string | number
}

interface typeParams {
    url: string,
    method?: string,
    headers?: typeObj,
    data?: typeObj,
    params?: typeObj
}

// 发送get请求
export const get = (params: typeParams) => {
    params.method = 'get'
    return axios(params)
}

// 发送post请求
export const post = (params: typeParams) => {
    params.method = 'post'
    return axios(params)
}